<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>心灵树洞 - 倾诉你的心声</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;
            background: linear-gradient(135deg, #2d5016 0%, #3d6b1f 25%, #4a7c23 50%, #2d5016 100%);
            min-height: 100vh;
            position: relative;
            overflow-x: hidden;
        }

        /* 森林背景动画 */
        .forest-bg {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 0;
        }

        .tree {
            position: absolute;
            bottom: 0;
            opacity: 0.3;
            animation: sway 8s ease-in-out infinite;
        }

        .tree:nth-child(1) {
            left: 5%;
            font-size: 4rem;
            animation-delay: 0s;
        }

        .tree:nth-child(2) {
            left: 15%;
            font-size: 3.5rem;
            animation-delay: 1s;
        }

        .tree:nth-child(3) {
            right: 10%;
            font-size: 4.5rem;
            animation-delay: 2s;
        }

        .tree:nth-child(4) {
            right: 25%;
            font-size: 3rem;
            animation-delay: 3s;
        }

        @keyframes sway {
            0%, 100% { transform: rotate(-2deg); }
            50% { transform: rotate(2deg); }
        }

        /* 飘落的叶子 */
        .leaf {
            position: absolute;
            color: #8fbc8f;
            font-size: 1.2rem;
            animation: fall 15s linear infinite;
            opacity: 0.6;
        }

        @keyframes fall {
            0% {
                transform: translateY(-100vh) rotate(0deg);
                opacity: 0;
            }
            10% {
                opacity: 0.6;
            }
            90% {
                opacity: 0.6;
            }
            100% {
                transform: translateY(100vh) rotate(360deg);
                opacity: 0;
            }
        }

        /* 主容器 */
        .container {
            position: relative;
            z-index: 1;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        /* 头部 */
        .header {
            text-align: center;
            margin-bottom: 40px;
            color: #f0f8e8;
        }

        .header h1 {
            font-size: 2.5rem;
            margin-bottom: 10px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        .header .subtitle {
            font-size: 1.1rem;
            opacity: 0.9;
            margin-bottom: 20px;
        }

        .privacy-notice {
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            border-radius: 15px;
            padding: 15px 20px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            font-size: 0.9rem;
            color: #e8f5e8;
        }

        .privacy-notice i {
            color: #90ee90;
            margin-right: 8px;
        }

        /* 树洞主体 */
        .tree-hole {
            background: rgba(139, 69, 19, 0.8);
            backdrop-filter: blur(15px);
            border-radius: 50px;
            padding: 40px;
            width: 100%;
            max-width: 600px;
            box-shadow: 
                inset 0 0 50px rgba(0,0,0,0.5),
                0 20px 40px rgba(0,0,0,0.3);
            border: 3px solid rgba(101, 67, 33, 0.8);
            position: relative;
        }

        .tree-hole::before {
            content: '';
            position: absolute;
            top: -10px;
            left: 50%;
            transform: translateX(-50%);
            width: 80%;
            height: 20px;
            background: rgba(101, 67, 33, 0.6);
            border-radius: 50%;
            box-shadow: 0 5px 15px rgba(0,0,0,0.4);
        }

        /* 输入区域 */
        .input-area {
            width: 100%;
        }

        .input-label {
            display: block;
            color: #f0e68c;
            font-size: 1.1rem;
            margin-bottom: 15px;
            text-align: center;
            font-weight: 500;
        }

        .message-input {
            width: 100%;
            min-height: 200px;
            background: rgba(255, 248, 220, 0.9);
            border: none;
            border-radius: 20px;
            padding: 20px;
            font-size: 1rem;
            font-family: inherit;
            resize: vertical;
            box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
            color: #2d4a22;
            line-height: 1.6;
        }

        .message-input::placeholder {
            color: #8b7355;
            opacity: 0.7;
        }

        .message-input:focus {
            outline: none;
            box-shadow: 
                inset 0 2px 10px rgba(0,0,0,0.1),
                0 0 0 3px rgba(144, 238, 144, 0.3);
        }

        /* 按钮区域 */
        .button-area {
            display: flex;
            gap: 15px;
            margin-top: 25px;
            justify-content: center;
        }

        .btn {
            padding: 12px 25px;
            border: none;
            border-radius: 25px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .btn-release {
            background: linear-gradient(45deg, #90ee90, #98fb98);
            color: #2d5016;
            box-shadow: 0 4px 15px rgba(144, 238, 144, 0.3);
        }

        .btn-release:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(144, 238, 144, 0.4);
        }

        .btn-clear {
            background: rgba(255, 255, 255, 0.2);
            color: #f0e68c;
            border: 1px solid rgba(255, 255, 255, 0.3);
        }

        .btn-clear:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: translateY(-2px);
        }

        /* 字数统计 */
        .char-count {
            text-align: right;
            margin-top: 10px;
            color: #deb887;
            font-size: 0.9rem;
        }

        /* 释放动画 */
        .release-animation {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 1000;
            pointer-events: none;
        }

        .floating-text {
            color: #90ee90;
            font-size: 1.5rem;
            font-weight: bold;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
            animation: floatUp 3s ease-out forwards;
        }

        @keyframes floatUp {
            0% {
                opacity: 1;
                transform: translateY(0);
            }
            100% {
                opacity: 0;
                transform: translateY(-100px);
            }
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .container {
                padding: 15px;
            }

            .header h1 {
                font-size: 2rem;
            }

            .tree-hole {
                padding: 25px;
            }

            .message-input {
                min-height: 150px;
                padding: 15px;
            }

            .button-area {
                flex-direction: column;
                align-items: center;
            }

            .btn {
                width: 200px;
                justify-content: center;
            }
        }

        /* 隐私提示弹窗 */
        .privacy-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.7);
            z-index: 2000;
            display: flex;
            justify-content: center;
            align-items: center;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }

        .privacy-modal.show {
            opacity: 1;
            visibility: visible;
        }

        .privacy-content {
            background: linear-gradient(135deg, #2d5016, #4a7c23);
            border-radius: 20px;
            padding: 30px;
            max-width: 500px;
            margin: 20px;
            color: #f0f8e8;
            text-align: center;
            box-shadow: 0 20px 40px rgba(0,0,0,0.5);
            border: 2px solid rgba(144, 238, 144, 0.3);
        }

        .privacy-content h3 {
            color: #90ee90;
            margin-bottom: 20px;
            font-size: 1.5rem;
        }

        .privacy-content p {
            line-height: 1.6;
            margin-bottom: 15px;
        }

        .privacy-content .btn {
            margin-top: 20px;
        }

        /* 返回首页按钮 */
        .back-home {
            position: fixed;
            top: 20px;
            left: 20px;
            z-index: 100;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 50px;
            padding: 10px 20px;
            color: #f0f8e8;
            text-decoration: none;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .back-home:hover {
            background: rgba(144, 238, 144, 0.2);
            transform: translateY(-2px);
        }
    </style>
</head>
<body>
    <!-- 返回首页 -->
    <a href="index.html" class="back-home">
        <i class="fas fa-home"></i>
        返回首页
    </a>

    <!-- 森林背景 -->
    <div class="forest-bg">
        <div class="tree">🌲</div>
        <div class="tree">🌳</div>
        <div class="tree">🌲</div>
        <div class="tree">🌳</div>
    </div>

    <!-- 主容器 -->
    <div class="container">
        <!-- 头部 -->
        <div class="header">
            <h1><i class="fas fa-tree"></i> 心灵树洞</h1>
            <p class="subtitle">在这里，你可以安全地倾诉内心的声音</p>
            <div class="privacy-notice">
                <i class="fas fa-shield-alt"></i>
                <strong>隐私保护：</strong>你的话语不会被保存，只会随风飘散在这片森林中
            </div>
        </div>

        <!-- 树洞主体 -->
        <div class="tree-hole">
            <div class="input-area">
                <label class="input-label" for="message">
                    <i class="fas fa-feather-alt"></i> 对着树洞说出你的心声吧...
                </label>
                <textarea 
                    id="message" 
                    class="message-input" 
                    placeholder="在这个安全的空间里，你可以倾诉任何心事...&#10;&#10;无论是快乐、悲伤、愤怒还是困惑，&#10;这里都会静静聆听你的声音。&#10;&#10;你的秘密会随着森林的风声消散，&#10;不会留下任何痕迹。"
                    maxlength="2000"
                ></textarea>
                <div class="char-count">
                    <span id="charCount">0</span> / 2000 字
                </div>
            </div>

            <div class="button-area">
                <button class="btn btn-release" onclick="releaseMessage()">
                    <i class="fas fa-paper-plane"></i>
                    释放到森林中
                </button>
                <button class="btn btn-clear" onclick="clearMessage()">
                    <i class="fas fa-eraser"></i>
                    清空重写
                </button>
            </div>
        </div>
    </div>

    <!-- 隐私提示弹窗 -->
    <div class="privacy-modal" id="privacyModal">
        <div class="privacy-content">
            <h3><i class="fas fa-user-secret"></i> 隐私承诺</h3>
            <p>🌿 你的话语不会被记录或保存</p>
            <p>🍃 没有人能看到你写的内容</p>
            <p>🌱 这里只是一个纯粹的情感释放空间</p>
            <p>🌸 让心灵在这片森林中自由呼吸</p>
            <button class="btn btn-release" onclick="closePrivacyModal()">
                <i class="fas fa-heart"></i>
                我明白了
            </button>
        </div>
    </div>

    <script>
        // 字数统计
        const messageInput = document.getElementById('message');
        const charCount = document.getElementById('charCount');

        messageInput.addEventListener('input', function() {
            const count = this.value.length;
            charCount.textContent = count;
            
            // 字数接近上限时改变颜色
            if (count > 1800) {
                charCount.style.color = '#ff6b6b';
            } else if (count > 1500) {
                charCount.style.color = '#ffa500';
            } else {
                charCount.style.color = '#deb887';
            }
        });

        // 释放消息
        function releaseMessage() {
            const message = messageInput.value.trim();
            
            if (!message) {
                alert('请先写下你想说的话...');
                return;
            }

            // 创建释放动画
            createReleaseAnimation();
            
            // 清空输入框
            setTimeout(() => {
                messageInput.value = '';
                charCount.textContent = '0';
                charCount.style.color = '#deb887';
            }, 1000);
        }

        // 清空消息
        function clearMessage() {
            if (messageInput.value.trim() && !confirm('确定要清空已写的内容吗？')) {
                return;
            }
            
            messageInput.value = '';
            charCount.textContent = '0';
            charCount.style.color = '#deb887';
            messageInput.focus();
        }

        // 创建释放动画
        function createReleaseAnimation() {
            const messages = [
                '你的心声已经释放到森林中... 🌿',
                '愿你的心情如森林般宁静... 🍃',
                '让烦恼随风而去... 🌸',
                '森林在静静聆听你的声音... 🌲',
                '心灵得到了释放... ✨'
            ];
            
            const randomMessage = messages[Math.floor(Math.random() * messages.length)];
            
            const animationDiv = document.createElement('div');
            animationDiv.className = 'release-animation';
            animationDiv.innerHTML = `<div class="floating-text">${randomMessage}</div>`;
            
            document.body.appendChild(animationDiv);
            
            // 3秒后移除动画元素
            setTimeout(() => {
                document.body.removeChild(animationDiv);
            }, 3000);
        }

        // 创建飘落的叶子
        function createFallingLeaf() {
            const leaves = ['🍃', '🍂', '🌿', '🍀'];
            const leaf = document.createElement('div');
            leaf.className = 'leaf';
            leaf.textContent = leaves[Math.floor(Math.random() * leaves.length)];
            leaf.style.left = Math.random() * 100 + '%';
            leaf.style.animationDuration = (Math.random() * 10 + 10) + 's';
            leaf.style.animationDelay = Math.random() * 5 + 's';
            
            document.querySelector('.forest-bg').appendChild(leaf);
            
            // 动画结束后移除叶子
            setTimeout(() => {
                if (leaf.parentNode) {
                    leaf.parentNode.removeChild(leaf);
                }
            }, 20000);
        }

        // 定期创建飘落的叶子
        setInterval(createFallingLeaf, 3000);

        // 隐私弹窗
        function showPrivacyModal() {
            document.getElementById('privacyModal').classList.add('show');
        }

        function closePrivacyModal() {
            document.getElementById('privacyModal').classList.remove('show');
        }

        // 页面加载时显示隐私提示
        window.addEventListener('load', function() {
            setTimeout(showPrivacyModal, 1000);
        });

        // 键盘快捷键
        messageInput.addEventListener('keydown', function(e) {
            // Ctrl+Enter 快速释放
            if (e.ctrlKey && e.key === 'Enter') {
                releaseMessage();
            }
            // Ctrl+Delete 快速清空
            if (e.ctrlKey && e.key === 'Delete') {
                clearMessage();
            }
        });

        // 防止意外离开页面时丢失内容
        window.addEventListener('beforeunload', function(e) {
            if (messageInput.value.trim()) {
                e.preventDefault();
                e.returnValue = '你还有未释放的心声，确定要离开吗？';
            }
        });
    </script>
</body>
</html>